; ModuleID = 'worlk_in_group05.c'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"

%struct.MPI_Status = type { i32, i32, i32, i32, i32 }
%struct.ompi_communicator_t = type opaque
%struct.ompi_datatype_t = type opaque
%struct.ompi_predefined_communicator_t = type opaque
%struct.ompi_predefined_datatype_t = type opaque

@ompi_mpi_comm_world = external global %struct.ompi_predefined_communicator_t ; <%struct.ompi_predefined_communicator_t*> [#uses=1]
@ompi_mpi_double = external global %struct.ompi_predefined_datatype_t ; <%struct.ompi_predefined_datatype_t*> [#uses=1]
@.str = private constant [22 x i8] c"P:%d my x[%d][2]=%1f\0A\00", align 1 ; <[22 x i8]*> [#uses=1]

define void @main(i32 %argc, i8** %argv) nounwind {
entry:
  %argc_addr = alloca i32                         ; <i32*> [#uses=2]
  %argv_addr = alloca i8**                        ; <i8***> [#uses=2]
  %coltype = alloca %struct.ompi_datatype_t*      ; <%struct.ompi_datatype_t**> [#uses=4]
  %x = alloca [4 x [8 x double]], align 8         ; <[4 x [8 x double]]*> [#uses=4]
  %status = alloca %struct.MPI_Status             ; <%struct.MPI_Status*> [#uses=1]
  %j = alloca i32                                 ; <i32*> [#uses=6]
  %i = alloca i32                                 ; <i32*> [#uses=12]
  %rank = alloca i32                              ; <i32*> [#uses=4]
  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
  store i32 %argc, i32* %argc_addr
  store i8** %argv, i8*** %argv_addr
  %0 = call i32 @MPI_Init(i32* %argc_addr, i8*** %argv_addr) nounwind ; <i32> [#uses=0]
  %1 = call i32 @MPI_Comm_rank(%struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*), i32* %rank) nounwind ; <i32> [#uses=0]
  %2 = call i32 @MPI_Type_vector(i32 4, i32 1, i32 8, %struct.ompi_datatype_t* bitcast (%struct.ompi_predefined_datatype_t* @ompi_mpi_double to %struct.ompi_datatype_t*), %struct.ompi_datatype_t** %coltype) nounwind ; <i32> [#uses=0]
  %3 = call i32 @MPI_Type_commit(%struct.ompi_datatype_t** %coltype) nounwind ; <i32> [#uses=0]
  %4 = load i32* %rank, align 4                   ; <i32> [#uses=1]
  %5 = icmp eq i32 %4, 3                          ; <i1> [#uses=1]
  br i1 %5, label %bb, label %bb7

bb:                                               ; preds = %entry
  store i32 0, i32* %i, align 4
  br label %bb5

bb1:                                              ; preds = %bb5
  store i32 0, i32* %j, align 4
  br label %bb3

bb2:                                              ; preds = %bb3
  %6 = load i32* %i, align 4                      ; <i32> [#uses=1]
  %7 = load i32* %j, align 4                      ; <i32> [#uses=1]
  %8 = load i32* %i, align 4                      ; <i32> [#uses=1]
  %9 = add nsw i32 %8, 1                          ; <i32> [#uses=1]
  %10 = sitofp i32 %9 to double                   ; <double> [#uses=1]
  %11 = call double @llvm.pow.f64(double 1.000000e+01, double %10) ; <double> [#uses=1]
  %12 = load i32* %j, align 4                     ; <i32> [#uses=1]
  %13 = sitofp i32 %12 to double                  ; <double> [#uses=1]
  %14 = fadd double %11, %13                      ; <double> [#uses=1]
  %15 = getelementptr inbounds [4 x [8 x double]]* %x, i32 0, i32 %6 ; <[8 x double]*> [#uses=1]
  %16 = getelementptr inbounds [8 x double]* %15, i32 0, i32 %7 ; <double*> [#uses=1]
  store double %14, double* %16, align 4
  %17 = load i32* %j, align 4                     ; <i32> [#uses=1]
  %18 = add nsw i32 %17, 1                        ; <i32> [#uses=1]
  store i32 %18, i32* %j, align 4
  br label %bb3

bb3:                                              ; preds = %bb2, %bb1
  %19 = load i32* %j, align 4                     ; <i32> [#uses=1]
  %20 = icmp sle i32 %19, 7                       ; <i1> [#uses=1]
  br i1 %20, label %bb2, label %bb4

bb4:                                              ; preds = %bb3
  %21 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %22 = add nsw i32 %21, 1                        ; <i32> [#uses=1]
  store i32 %22, i32* %i, align 4
  br label %bb5

bb5:                                              ; preds = %bb4, %bb
  %23 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %24 = icmp sle i32 %23, 3                       ; <i1> [#uses=1]
  br i1 %24, label %bb1, label %bb6

bb6:                                              ; preds = %bb5
  %25 = load %struct.ompi_datatype_t** %coltype, align 4 ; <%struct.ompi_datatype_t*> [#uses=1]
  %26 = getelementptr inbounds [4 x [8 x double]]* %x, i32 0, i32 0 ; <[8 x double]*> [#uses=1]
  %27 = getelementptr inbounds [8 x double]* %26, i32 0, i32 7 ; <double*> [#uses=1]
  %28 = bitcast double* %27 to i8*                ; <i8*> [#uses=1]
  %29 = call i32 @MPI_Send(i8* %28, i32 1, %struct.ompi_datatype_t* %25, i32 1, i32 52, %struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*)) nounwind ; <i32> [#uses=0]
  br label %bb11

bb7:                                              ; preds = %entry
  %30 = load i32* %rank, align 4                  ; <i32> [#uses=1]
  %31 = icmp eq i32 %30, 1                        ; <i1> [#uses=1]
  br i1 %31, label %bb8, label %bb11

bb8:                                              ; preds = %bb7
  %32 = load %struct.ompi_datatype_t** %coltype, align 4 ; <%struct.ompi_datatype_t*> [#uses=1]
  %33 = getelementptr inbounds [4 x [8 x double]]* %x, i32 0, i32 0 ; <[8 x double]*> [#uses=1]
  %34 = getelementptr inbounds [8 x double]* %33, i32 0, i32 2 ; <double*> [#uses=1]
  %35 = bitcast double* %34 to i8*                ; <i8*> [#uses=1]
  %36 = call i32 @MPI_Recv(i8* %35, i32 1, %struct.ompi_datatype_t* %32, i32 3, i32 52, %struct.ompi_communicator_t* bitcast (%struct.ompi_predefined_communicator_t* @ompi_mpi_comm_world to %struct.ompi_communicator_t*), %struct.MPI_Status* %status) nounwind ; <i32> [#uses=0]
  store i32 0, i32* %i, align 4
  br label %bb10

bb9:                                              ; preds = %bb10
  %37 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %38 = getelementptr inbounds [4 x [8 x double]]* %x, i32 0, i32 %37 ; <[8 x double]*> [#uses=1]
  %39 = getelementptr inbounds [8 x double]* %38, i32 0, i32 2 ; <double*> [#uses=1]
  %40 = load double* %39, align 4                 ; <double> [#uses=1]
  %41 = load i32* %rank, align 4                  ; <i32> [#uses=1]
  %42 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %43 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([22 x i8]* @.str, i32 0, i32 0), i32 %41, i32 %42, double %40) nounwind ; <i32> [#uses=0]
  %44 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %45 = add nsw i32 %44, 1                        ; <i32> [#uses=1]
  store i32 %45, i32* %i, align 4
  br label %bb10

bb10:                                             ; preds = %bb9, %bb8
  %46 = load i32* %i, align 4                     ; <i32> [#uses=1]
  %47 = icmp sle i32 %46, 3                       ; <i1> [#uses=1]
  br i1 %47, label %bb9, label %bb11

bb11:                                             ; preds = %bb10, %bb7, %bb6
  %48 = call i32 @MPI_Finalize() nounwind         ; <i32> [#uses=0]
  br label %return

return:                                           ; preds = %bb11
  ret void
}

declare i32 @MPI_Init(i32*, i8***)

declare i32 @MPI_Comm_rank(%struct.ompi_communicator_t*, i32*)

declare i32 @MPI_Type_vector(i32, i32, i32, %struct.ompi_datatype_t*, %struct.ompi_datatype_t**)

declare i32 @MPI_Type_commit(%struct.ompi_datatype_t**)

declare double @llvm.pow.f64(double, double) nounwind readonly

declare i32 @MPI_Send(i8*, i32, %struct.ompi_datatype_t*, i32, i32, %struct.ompi_communicator_t*)

declare i32 @MPI_Recv(i8*, i32, %struct.ompi_datatype_t*, i32, i32, %struct.ompi_communicator_t*, %struct.MPI_Status*)

declare i32 @printf(i8* noalias, ...) nounwind

declare i32 @MPI_Finalize()
